package ch.nostromo.tiffanys.tests.libraries;

import ch.nostromo.tiffanys.game.GameController;
import ch.nostromo.tiffanys.game.GameControllerException;
import ch.nostromo.tiffanys.game.game.GameIllegalMoveException;
import ch.nostromo.tiffanys.game.move.MoveInput;
import ch.nostromo.tiffanys.game.player.PlayerHuman;
import ch.nostromo.tiffanys.tests.TestBase;

public class TestRules extends TestBase {

  public void testEnPassant() throws GameControllerException {
    PlayerHuman white = this.getHumanPlayer();
    PlayerHuman black = this.getHumanPlayer();
    
    GameController gc = new GameController(white, black);

    gc.enterNextMove(new MoveInput("e2", "e4"));
    gc.enterNextMove(new MoveInput("e7", "e6"));
    gc.enterNextMove(new MoveInput("e4", "e5"));
    gc.enterNextMove(new MoveInput("f7", "f5"));
    
    try {
      gc.enterNextMove(new MoveInput("e5", "d6"));
      fail("Move should throw Exception");
    } catch (GameIllegalMoveException expected) {
      // Do nothing
    }

    gc.enterNextMove(new MoveInput("e5", "f6"));
  }
  
}
